﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Stamp.ascx.cs" Inherits="Admin_Components_Inventory_Stamp" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True">
</telerik:RadScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <telerik:RadTabStrip ID="TabStrip1" runat="server" EnableDragToReorder="true" Skin="Vista" MultiPageID="RadMultiPag1" SelectedIndex="1">
        <Tabs>
            <telerik:RadTab Text="THỐNG KÊ SỐ LƯỢNG TEM" Selected="True">
            </telerik:RadTab>
            <telerik:RadTab Text="NHẬP TEM">
            </telerik:RadTab>
            <telerik:RadTab Text="TÌM KIẾM THÔNG TIN TEM ĐÃ NHẬP">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPag1" runat="server" SelectedIndex="0">
      <telerik:RadPageView ID="RadPageView2" runat="server"  Height="400px" Style="overflow: hidden">                
                    <fieldset class="form" id="Fieldset1">
                          <br />
            <div class="form-horizontal wrapper-center clearfix">
                <div class="row col-md-12">
                     <telerik:RadTextBox ID="txtStamp" runat="server" CssClass="col-imp-3 inputForm" EmptyMessage="Loại tem" ></telerik:RadTextBox>
                     <telerik:RadNumericTextBox ID="txtQuantityFrom" runat="server" CssClass="col-imp-1 inputForm" EmptyMessage="Từ số lượng" ></telerik:RadNumericTextBox>
                     <telerik:RadNumericTextBox ID="txtQuantityTo" runat="server" CssClass="col-imp-1 inputForm" EmptyMessage="Đến số lượng" ></telerik:RadNumericTextBox>
                    <asp:Button ID="btnSearch" CssClass="btn btn-sm btn-primary" runat="server" Text="Xem" OnClick="btnSearch_Click" />
                </div>
          
            </div>
             <br />
             <div class="row" style="width:50%;margin-left:5px;">
                <telerik:RadGrid ID="gvStampWarehouse" runat="server" AutoGenerateColumns="False" CellSpacing="0"
                    AllowMultiRowSelection="True" GridLines="None" HeaderStyle-HorizontalAlign="Center"
                    HeaderStyle-BorderStyle="None" CssClass="table table-bordered" AllowPaging="true"
                    PageSize="50" AllowCustomPaging="true" OnNeedDataSource="gvStampWarehouse_NeedDataSource" Height = "300px">
                    <MasterTableView AllowPaging="True" PageSize="50" EditMode="InPlace" ShowHeader="true"
                        AutoGenerateColumns="False" NoMasterRecordsText="Không có dữ liệu.">
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <%# Container.ItemIndex + 1 %></ItemTemplate>
                                <HeaderStyle Width="50px" />
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn  DataField="StampName" UniqueName="StampName"  ReadOnly="true" HeaderText="Loại tem">
                            <HeaderStyle HorizontalAlign="Left" Width ="250px"/>
                            <ItemStyle HorizontalAlign="Left" Width ="250px" Font-Bold ="true"/>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn  HeaderText="Số lượng tem" DataField="Quantity" UniqueName="Quantity"  ReadOnly="true" DataFormatString="{0:###,###}">
                            <HeaderStyle HorizontalAlign="Right" Width="60px" />
                            <ItemStyle HorizontalAlign="Right" Width="60px" />
                            </telerik:GridBoundColumn>
                        </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
                </MasterTableView>
                <ClientSettings>
                <Selecting AllowRowSelect="true" /></ClientSettings>
                <ClientSettings>
                <Scrolling AllowScroll="true" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                </ClientSettings>
                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
                </telerik:RadGrid>
            </div>
            </fieldset>
            </telerik:RadPageView>
     <telerik:RadPageView ID="RadPageView1" runat="server" Height="505px" Style="overflow: hidden">
        <fieldset class="form" id="fsGeneral">
        <br />
         <div class="form-horizontal wrapper-center clearfix">
            <div class="row col-md-12">
            <div class="form-group text-left" style="margin-left:15px;">
                <div class="form-group text-left">
                    <telerik:RadComboBox ID="cboProduct" runat="server" CssClass="col-imp-4" EmptyMessage="Chọn loại tem" filter="Contains"></telerik:RadComboBox>
                    <telerik:RadNumericTextBox ID="txtQuantityStamp" runat="server" CssClass="col-imp-1 inputForm" EmptyMessage="Số lượng tem" ></telerik:RadNumericTextBox>
                    <asp:Button ID="btnAddProduct" CssClass="btn btn-sm btn-primary" runat="server" Text="Thêm" OnClick="btnAdd_Click" ValidationGroup="g3" OnClientClick="fnOnUpdateValidators('g3');"/>
                </div>
            </div>
                <div>
            <asp:RequiredFieldValidator  ID="RequiredcboProduct" runat="server" ControlToValidate="cboProduct" ValidationGroup="g3"
                ErrorMessage=""></asp:RequiredFieldValidator>
           
            <asp:RequiredFieldValidator  ID="RequiredtxtWeight" runat="server" ControlToValidate="txtQuantityStamp" ValidationGroup="g3"
                ErrorMessage=""></asp:RequiredFieldValidator>
            </div>
            <div class="row" style="width:60%">
                    <telerik:radgrid id="gvData" runat="server" cellspacing="0" cssclass=" table table-bordered"
                        gridlines="None" autogeneratecolumns="False" headerstyle-horizontalalign="Center" OnItemCommand="grvData_ItemCommand"
                        allowmultirowselection="True" headerstyle-borderstyle="None">
                        <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true" EditMode="InPlace">
                        <Columns>
                            <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <%# Container.ItemIndex + 1 %></ItemTemplate>
                                <HeaderStyle Width="50px" />
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                UniqueName="ProductID" DataField="ProductID" Display="false">
                            </telerik:GridBoundColumn>
                             <telerik:GridBoundColumn  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                UniqueName="PackType" DataField="PackType" Display="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn  DataField="ProductName" UniqueName="ProductName"  ReadOnly="true" HeaderText="Loại tem">
                            <HeaderStyle HorizontalAlign="Left" Width ="250px"/>
                            <ItemStyle HorizontalAlign="Left" Width ="250px" Font-Bold ="true"/>
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn  HeaderText="Số lượng tem">
                            <ItemTemplate>
                                <telerik:RadNumericTextBox Enabled="false" ID="txtQuantity" runat="server" Text='<%#Eval("Quantity") %>'
                                    NumberFormat-DecimalDigits="0" MinValue="0" CssClass="col-imp-10 inputForm"/>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Right" Width="60px" />
                            <ItemStyle HorizontalAlign="Right" Width="60px" />
                            </telerik:GridTemplateColumn>

                            <telerik:GridTemplateColumn HeaderText="Sửa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                            <asp:Button ID="btnEdit" CssClass="btnEdit" CommandArgument='<%# Eval("Key")%>'
                                CommandName="EditItem" runat="server"></asp:Button>
                            </ItemTemplate>
                            <HeaderStyle Width="30px"/>
                            <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridTemplateColumn>

                            <telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="lnkEditDel" CssClass="btnX" CommandArgument='<%# Eval("Key") %>'
                                    OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa?')" CommandName="EditDelItem"
                                    runat="server"></asp:Button>
                            </ItemTemplate>
                            <HeaderStyle Width="30px"/>
                                <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView>
                    </telerik:radgrid>
                </div>
            </div>
            </div>
        <!--Action-->
        <div class="set-btns text-center">
            <asp:Button ID="btnSave" CssClass="btn btn-sm btn-primary" runat="server" Text="Lưu" OnClick="btnSave_Click" ValidationGroup="g1" OnClientClick="fnOnUpdateValidators('g1');"/>
            <asp:Button ID="btnIn" CssClass="btn btn-sm btn-primary" runat="server" Text="Nhập kho" OnClick="btnIn_Click" ValidationGroup="g1" OnClientClick="fnOnUpdateValidators('g1');"/>
            <asp:Button ID="btnReset" runat="server" CssClass="btn btn-sm btn-primary" Text="Tạo mới" OnClick="btnReset_Click"/>
        </div>
        <!--End Action -->
        </fieldset>
    </telerik:RadPageView>
    <telerik:RadPageView ID="RadPageView3" runat="server" Height="505px" Style="overflow: hidden">
        <fieldset class="form" id="Fieldset2">
        <br />
         <div class="form-horizontal wrapper-center clearfix">
            
            <div class="form-group text-left" style="margin-left:15px;">
                <div class="form-group col-md-6">
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Loại tem</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtTypeStampSearch" CssClass="col-imp-8 inputForm" runat="server"  />
                        </div>
                    </div>
                  <!--End Dòng -->
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">User nhập</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtUserIn" CssClass="col-imp-8 inputForm" runat="server"  />
                        </div>
                    </div>
                  <!--End Dòng -->
                </div>
                  <!--Block bên phải -->
                <div class="form-group col-md-6">
                     <div class="form-group">
                        <label class="col-md-3 control-label">
                            Nhập từ ngày </label>
                        <div class="col-md-8">

                        <telerik:RadDatePicker ID="dtFromDate" cssclass="col-imp-8" enabled="true" runat="server">
                            <Calendar ID="Calendar1" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                            </Calendar>
                            <DateInput   style="width:200px" DisplayDateFormat="dd/MM/yyyy HH:mm" DateFormat="dd/MM/yyyy HH:mm"></DateInput>

                        </telerik:RadDatePicker>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Nhập đến ngày </label>
                        <div class="col-md-8">

                        <telerik:RadDatePicker ID="dtToDate" cssclass="col-imp-8" enabled="true" runat="server">
                            <Calendar ID="Calendar2" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                            </Calendar>
                            <DateInput  style="width:200px" DisplayDateFormat="dd/MM/yyyy HH:mm" DateFormat="dd/MM/yyyy HH:mm"></DateInput>

                        </telerik:RadDatePicker>
                        </div>
                    </div>
                </div>
              <!--Action-->
        <div class="set-btns text-center">
            <asp:Button ID="btnSearchStampIn" CssClass="btn btn-sm btn-primary" runat="server" Text="Tìm kiếm" OnClick="btnSearchStampIn_Click"/>
        </div>
        <!--End Action -->
            <div class="row" style="width:90%">
                 <telerik:radgrid id="gvDataSearch" runat="server" cellspacing="0" cssclass=" table table-bordered" OnItemDataBound="gvDataSearch_ItemDataBound" 
                        gridlines="None" autogeneratecolumns="False" headerstyle-horizontalalign="Center" OnItemCommand="gvDataSearch_ItemCommand"
                        PageSize="50" AllowCustomPaging="true" AllowPaging="true"  OnNeedDataSource="gvDataSearch_NeedDataSource"
                        allowmultirowselection="True" headerstyle-borderstyle="None">
                        <MasterTableView AllowPaging="True" PageSize="50" EditMode="InPlace" ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true">
                    <Columns>
                        <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Container.ItemIndex + 1 %></ItemTemplate>
                            <HeaderStyle Width="50px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                            UniqueName="ProductID" DataField="ProductID" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                            UniqueName="StatusCode" DataField="StatusCode" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                            UniqueName="PackType" DataField="PackType" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn  DataField="StampName" UniqueName="StampName"  ReadOnly="true" HeaderText="Loại tem">
                            <HeaderStyle HorizontalAlign="Center" Width ="250px"/>
                            <ItemStyle HorizontalAlign="Left" Width ="250px" Font-Bold ="true"/>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn  DataField="Quantity" UniqueName="Quantity"  ReadOnly="true" HeaderText="Số lượng" DataFormatString="{0:###,###}">
                            <HeaderStyle HorizontalAlign="Center" Width="100px" />
                            <ItemStyle HorizontalAlign="Center" Width="100px" />
                        </telerik:GridBoundColumn>
                         <telerik:GridBoundColumn  DataField="UserIn" UniqueName="UserIn"  ReadOnly="true" HeaderText="User nhập" >
                             <HeaderStyle HorizontalAlign="Center" Width="100px" />
                            <ItemStyle HorizontalAlign="Center" Width="100px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn  DataField="DateIn" UniqueName="DateIn"  ReadOnly="true" HeaderText="Ngày nhập" >
                            <HeaderStyle HorizontalAlign="Center" Width="100px" />
                            <ItemStyle HorizontalAlign="Center" Width="100px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn  DataField="Status" UniqueName="Status"  ReadOnly="true" HeaderText="Tình trạng" >
                             <HeaderStyle HorizontalAlign="Center" Width="100px" />
                            <ItemStyle HorizontalAlign="Center" Width="100px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Sửa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                        <asp:Button ID="btnEditStamp" CssClass="btnEdit" CommandArgument='<%# Eval("Key")%>'
                            CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                        <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="btnDelStamp" CssClass="btnX" CommandArgument='<%# Eval("Key") %>'
                                OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa?')" CommandName="DelItem"
                                runat="server"></asp:Button>
                        </ItemTemplate>
                    <HeaderStyle Width="30px"/>
                    <ItemStyle HorizontalAlign="Center" />
            </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        </telerik:radgrid>
        </div>
        </div>
        
        </fieldset>
    </telerik:RadPageView>
    </telerik:RadMultiPage> 
        <!--Tim kiem -->
        
    </ContentTemplate>
</asp:UpdatePanel>
<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
